import http from "./http";
import qs from "qs";
import axios from 'axios'
export default {
  //卖家列表查询
  saleList(params, that = {source: null}) {
    return http.get("/member/trans/buy/saleList", params, {
      cancelToken: new axios.CancelToken(function executor(c) {
        // 设置 cancel token
        that.source = c;
      })
    });
  },

  //卖币-卖家操作
  confirmTrans(params) {
    return http.post("/member/trans/sale/confirmTrans?"+qs.stringify(params),params);
  },
  //订单列表查询
  orderList(params, that = {source: null}) {
    return http.get("/member/trans/order/list", params, {
      cancelToken: new axios.CancelToken(function executor(c) {
        // 设置 cancel token
        that.source = c;
      })
    });
  },
  // 买币-自动匹配
  transPayAuto(params) {
    return http.post("/member/trans/buy/transPayAuto?"+qs.stringify(params),params);
  },
  // 自动匹配失败 推荐列表
  transPayAutoFail(params) {
    return http.post("member/trans/buy/transPayAutoFail?"+qs.stringify(params),params);
  },

  //查询未完成订单数量
  orderCount() {
    return http.get("/member/trans/order/count");
  },

  //收款方式列表
  payee(params) {
    return http.get("/member/payee",params);
  },

  //卖家详情查询
  saleInfo(params) {
    return http.get("/member/trans/saleInfo",params);
  },
  //买币-成交次数查询
  saleCount(params) {
    return http.get("/member/trans/buy/saleCount",params);
  },

  // 买币-手动确认购买
  transPay(params) {
    return http.post("/member/trans/buy/transPay?"+qs.stringify(params),params);
  },
};
